package com.example.wxnews.controller;

import com.example.wxnews.entity.Comment;
import com.example.wxnews.service.CommentService;
import org.apache.ibatis.annotations.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("api/comment")
public class CommentController {
    @Autowired
    private CommentService commentService;

    @GetMapping
    public List<Comment> getAll(){
        return commentService.getCommentList();
    }

    @PostMapping
    public Comment insertBook(@RequestBody Comment comment){
        return commentService.insert(comment);
    }

}

